<#include "/layout/layout.ftl">
<#import "/layout/macro.ftl" as macro>
<#assign css>
<style>
</style>
</#assign>
<#assign js>
<script>
    function del(id) {
        layer.confirm('确定删除吗?', {icon: 3, title: '提示'}, function (index) {
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "${ctx!}/task/delete/" + id,
                success: function (res) {
                    layer.msg(res.message, {time: 2000}, function () {
                        location.reload();
                    });
                }
            });
        });
    }
</script>
</#assign>
<@layout title="任务列表" active="user">
<!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        任务列表
        <small>一切从这里开始</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-cog"></i> 系统</a></li>
        <li><a href="#"><i class="fa fa-list-ul"></i> 任务管理</a></li>
        <li class="active"><i class="fa fa-table"></i> 任务列表</li>
    </ol>
</section>

<!-- Main content -->
<section class="content">
    <!-- Default box -->
    <div class="box box-primary">
        <div class="box-header">
       <#-- <@shiro.hasPermission name="system:user:add">
            <a class="btn btn-sm btn-success" href="${ctx!}/user/add">新增</a>
        </@shiro.hasPermission>-->
           <div class="card-content">
               <form id="form" action="${ctx!}/task/index">

                       <div class="col s12">
                           <div class="input-field inline"> 帐号:</div>
                           <div class="input-field inline">
                               <input type="text"  name="account" autocomplete="off"
                                      value="${account}">
                           </div>

                           <div class="input-field inline">
                               <button class="btn btn-sm btn-success" id="serach">搜索</button>
                           </div>
                           <a class="btn btn-sm btn-success" href="${ctx!}/task/add">新增</a>
                       </div>

               </form>
           </div>
        </div>
        <div class="box-body table-responsive">
            <table class="table table-striped">
                <thead>
              <#--  <th><input type="checkbox" id="checkAll" name="checkAll" />全选</th>-->
                    <th>ID</th>
                    <th>创建人</th>
                    <th>任务名</th>
                    <th>组名</th>
                    <th>执行ip</th>
                    <th>类路径</th>
                    <th>执行时间</th>
                    <th>描述</th>
                    <#--<th>参数</th>-->
                    <th>创建时间</th>
                    <th>操作</th>

                </thead>
                <#list pageInfo.content as task>
                <tr>
                  <#--  <td><input type="checkbox" name="checkItem"  value="${log.id}" /></td>-->
                    <td>${task.id}</td>
                    <td>${task.userName}</td>
                    <td>${task.quartzName}</td>
                      <td>${task.quartzGrop}</td>

                    <td>${task.ip}</td>
                    <td>${task.classPath}</td>
                      <td>${task.cronExpression}</td>
                    <td>${task.remark}</td>
                    <#--<td>${log.args}</td>-->
                    <td>${task.createTime}</td>
                      <td>

				    	<a class="btn btn-sm btn-primary" href="${ctx!}/task/edit/${task.id}">编辑</a>


                        <button class="btn btn-sm btn-danger" onclick="del(${task.id})">删除</button>

                      </td>
                </tr>
                </#list>
            </table>
        </div>
        <!-- /.box-body -->
        <div class="box-footer clearfix">
            <@macro.page pageInfo=pageInfo url="${ctx!}/task/index?account=${account}" />
        </div>
    </div>
    <!-- /.box -->

</section>
<!-- /.content -->
</@layout>